import {GET_HOME_IMG,GET_HOME_NAV,GET_HOME_PRODUCT} from '../actionTypes'
//定义一个初始的状态
const defaultState={
    imgHeight: 170,
    swiperList:[],//轮播图
    navList:[],//导航
    productList:[]
}

//导出一个处理函数
export default(state=defaultState,action)=>{
    let newState=JSON.parse(JSON.stringify(state))
    switch(action.type){
        case GET_HOME_IMG:
            newState.swiperList=action.payload.swiperList
            break;
        case GET_HOME_NAV:
            newState.navList=action.payload.navList
            break;
        case GET_HOME_PRODUCT:
            newState.productList=action.payload.productList
            break;
        default:
            break;
    }

    return newState
}